Previous Book Contents Book Index Next

Inside Macintosh: AppleScript Finder Guide /
Chapter 3 - Finder Commands / Command Definitions


Data Size

A Data Size command is a request for the size, in bytes, of the data of one or more objects. The value returned is the size of the data (a value) that would result from a Get command on the same object or objects. This command has little meaning for the Finder, because the result of a Get command for most Finder objects is a reference. In the case of icons, Data Size returns the data size of the icon family.

SYNTAX
data size of referenceToObject [ as className ]
PARAMETERS
referenceToObject
A reference to the object or objects whose data size is to
be returned.
Class: Reference
className
The class of data for which to determine the size.
Class: Reference
Default value: The default value class for the object
RESULT
An integer that indicates the size, in bytes, of the data that would be returned by a Get command on the specified object or objects. For most Finder objects, this command returns the size of the reference, not the size of the object referred to.

If the referenceToObject parameter specifies a single object only (such as icon of file "My File" of startup disk or window 1), the result is a single integer that specifies the data size in bytes. If the specified object doesn't exist, the Finder returns an error.

If the referenceToObject parameter refers to more than one object (such as items of startup disk), the result is a list of integers. The first item
in the list is the data size of the first item, the second item is the data size of
the second item, and so on. If the specified objects don't exist, the result is
an empty list.

EXAMPLE
This script returns a list of integers that specify the size, in bytes, of the icons for the files My File and My Other File, both located on the startup disk:

tell application "Finder"   data size of {icon of file "My File" of startup disk, ¬
      icon of file "My Other File" of startup disk}
end tell 

--result: {1016, 2320}

Previous Book Contents Book Index Next

© Apple Computer, Inc.
13 JUL 1996